Array.prototype.myMap = function(fn) {
  if(typeof fn !== 'function') {
    throw new TypeError('fn must be a function')
  }
  let res = []
  for(let i = 0; i < this.length; i++) {
    res.push(fn.call(null, this[i], i, this))
  }
  return res
}
let arr = [
  {
    name: '11',
    age: 30
  },
  {
    name: '11',
    age: 40
  },
  {
    name: 'dfsh',
    age: 30
  }
]
function fn(item, index, arr) {
  return item.age
}
console.log(arr.map(fn));
console.log(arr.myMap(fn));
